<?php
namespace Admin\Model;
use Think\Model;
use Think\Page;
use Think\Db;

class GuidModel extends Model{
    
    
    public function guid_list($type){
    
        $map['cata_two']=$type;
        $page=$this->get_page($map);
        $result['show']=$page->show();
        $result['list']=$this->where($map)->limit($page->firstRow.','.$page->listRows)->select();
        return   $result;
    
    }
    
    public function getCata($type){
        $map['parent_id']=$type;
        $page=$this->get_page($map,'category');
        $result['show']=$page->show();
        $result['list']=M('category')->where($map)->limit($page->firstRow.','.$page->listRows)->select();
        return   $result;
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    public function get_page($map,$table_q='Guid'){
         
        $count      = M($table_q)->where($map)->count();// 查询满足要求的总记录数
        $Page       = new \Think\Page($count,10);// 实例化分页类 传入总记录数和每页显示的记录数(1)
        $Page -> setConfig('prev','上一页');
        $Page -> setConfig('next','下一页');
        $Page->setConfig('theme', ' %FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER% ');
        return $Page;
         
    }
}